package gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class AlteraLaboratorio extends javax.swing.JPanel {
	private JLabel title;
	private JTextField nomeLabTxt;
	private JTextField numCompLabTxt;
	private JLabel validaNomeLab;
	private JLabel validaNumComp;
	private JLabel validaCapAluno;
	private JLabel validaHoraInit;
	private JLabel validaHoraFinit;
	private JTextField capAluLabTxt;
	private JLabel jLabel1;
	private JTextField horaFuncInitA;
	private JLabel doisPontos;
	private JTextField horaFuncInitB;
	private JTextField horaFuncFinalA;
	private JLabel jLabel2;
	private JButton salvar;
	private JLabel nomeLab;
	private JLabel numCompLab;
	private JLabel capAlunosLab;
	private JLabel horaFuncLab;
	private JTextField horaFuncFinalB;
	private JButton voltar;
	private JButton alterar;

	/**
	 * Auto-generated main method to display this JPanel inside a new JFrame.
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new AlteraLaboratorio());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public AlteraLaboratorio() {
		super();
		initGUI();

	}

	private void initGUI() {
		try {
			{
				this.setPreferredSize(new java.awt.Dimension(1433, 376));
			}
			this.setPreferredSize(new java.awt.Dimension(800, 600));
			this.setBackground(new java.awt.Color(209, 209, 255));
			this.setLayout(null);
			{
				title = new JLabel();
				this.add(title);
				title.setText("                    Visualiza Laboratorio");
				title.setBounds(35, 20, 732, 84);
				title.setBorder(BorderFactory
						.createEtchedBorder(BevelBorder.LOWERED));
				title.setFont(new java.awt.Font("Arial", 0, 36));
				title.setForeground(new java.awt.Color(64, 128, 128));
			}
			{
				alterar = new JButton();
				this.add(alterar);
				alterar.setText("Alterar");
				alterar.setBounds(435, 547, 101, 23);
				alterar.setBorder(BorderFactory
						.createEtchedBorder(BevelBorder.LOWERED));
				alterar.setFont(new java.awt.Font("Arial", 0, 12));
				alterar.setBackground(new java.awt.Color(255, 255, 255));
				nomeLabTxt.setEnabled(true);
				numCompLabTxt.setEnabled(true);
				capAluLabTxt.setEnabled(true);
				horaFuncInitA.setEnabled(true);
				horaFuncInitB.setEnabled(true);
				horaFuncFinalA.setEnabled(true);
				horaFuncFinalB.setEnabled(true);

			}
			{
				voltar = new JButton();
				this.add(voltar);
				voltar.setText("Voltar");
				voltar.setBounds(666, 547, 101, 23);
				voltar.setBorder(BorderFactory
						.createEtchedBorder(BevelBorder.LOWERED));
				voltar.setFont(new java.awt.Font("Arial", 0, 12));
				voltar.setBackground(new java.awt.Color(255, 255, 255));
			}
			{
				horaFuncFinalB = new JTextField();
				this.add(horaFuncFinalB);
				horaFuncFinalB.setFont(new java.awt.Font("Arial", 0, 14));
				horaFuncFinalB.setForeground(new java.awt.Color(192, 192, 192));
				horaFuncFinalB.setBounds(475, 401, 49, 26);
				horaFuncFinalB.setEditable(true);
				horaFuncFinalB.setEnabled(false);
				horaFuncFinalB.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent evt) {
						if (!horaFuncFinalB.isEditable()) {
							horaFuncFinalB.setText("");
							horaFuncFinalB.setEditable(true);
						}
					}
				});
				horaFuncFinalB.addKeyListener(new KeyAdapter() {
					public void keyReleased(KeyEvent evt) {
						// horaFuncFinalKeyReleased(evt);
					}
				});
			}
			{
				jLabel2 = new JLabel();
				this.add(jLabel2);
				jLabel2.setText(":");
				jLabel2.setFont(new java.awt.Font("Arial", 0, 18));
				jLabel2.setBounds(447, 347, 24, 40);
			}
			{
				horaFuncFinalA = new JTextField();
				this.add(horaFuncFinalA);
				horaFuncFinalA.setFont(new java.awt.Font("Arial", 0, 14));
				horaFuncFinalA.setForeground(new java.awt.Color(192, 192, 192));
				horaFuncFinalA.setBounds(380, 401, 49, 26);
				horaFuncFinalA.setEditable(true);
				horaFuncFinalA.setEnabled(false);
				horaFuncFinalA.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent evt) {
						if (!horaFuncFinalA.isEditable()) {
							horaFuncFinalA.setText("");
							horaFuncFinalA.setEditable(true);
						}
					}
				});
				horaFuncFinalA.addKeyListener(new KeyAdapter() {
					public void keyReleased(KeyEvent evt) {
						// horaFuncFinalKeyReleased(evt);
					}
				});
			}
			{
				horaFuncInitB = new JTextField();
				this.add(horaFuncInitB);
				horaFuncInitB.setFont(new java.awt.Font("Arial", 0, 12));
				horaFuncInitB.setForeground(new java.awt.Color(192, 192, 192));
				horaFuncInitB.setBounds(475, 356, 49, 26);
				horaFuncInitB.setEditable(true);
				horaFuncInitB.setEnabled(false);
				horaFuncInitB.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent evt) {
						if (!horaFuncInitB.isEditable()) {
							horaFuncInitB.setText("");
							horaFuncInitB.setEditable(true);
						}
					}
				});
				horaFuncInitB.addKeyListener(new KeyAdapter() {
					public void keyReleased(KeyEvent evt) {
						// horaFuncInitKeyReleased(evt);
					}
				});
			}
			{
				doisPontos = new JLabel();
				this.add(doisPontos);
				doisPontos.setText(":");
				doisPontos.setFont(new java.awt.Font("Arial", 0, 18));
				doisPontos.setBounds(447, 392, 21, 40);
			}
			{
				horaFuncInitA = new JTextField();
				this.add(horaFuncInitA);
				horaFuncInitA.setFont(new java.awt.Font("Arial", 0, 12));
				horaFuncInitA.setForeground(new java.awt.Color(192, 192, 192));
				horaFuncInitA.setBounds(380, 356, 49, 26);
				horaFuncInitA.setEditable(true);
				horaFuncInitA.setEnabled(false);
				horaFuncInitA.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent evt) {
						if (!horaFuncInitA.isEditable()) {
							horaFuncInitA.setText("");
							horaFuncInitA.setEditable(true);
						}
					}
				});
				horaFuncInitA.addKeyListener(new KeyAdapter() {
					public void keyReleased(KeyEvent evt) {
						// horaFuncInitKeyReleased(evt);
					}
				});
			}
			{
				jLabel1 = new JLabel();
				this.add(jLabel1);
				jLabel1.setText("Horario de funcionamento final");
				jLabel1.setFont(new java.awt.Font("Arial", 0, 18));
				jLabel1.setForeground(new java.awt.Color(0, 102, 102));
				jLabel1.setBounds(86, 398, 251, 29);
			}
			{
				capAluLabTxt = new JTextField();
				this.add(capAluLabTxt);
				capAluLabTxt.setFont(new java.awt.Font("Arial", 0, 14));
				capAluLabTxt.setForeground(new java.awt.Color(192, 192, 192));
				capAluLabTxt.setBounds(380, 309, 251, 26);
				capAluLabTxt.setEditable(true);
				capAluLabTxt.setEnabled(false);
				capAluLabTxt.addKeyListener(new KeyAdapter() {
					public void keyReleased(KeyEvent evt) {
						// capAluTxtKeyReleased(evt);
					}
				});
			}
			{
				numCompLabTxt = new JTextField();
				this.add(numCompLabTxt);
				numCompLabTxt.setFont(new java.awt.Font("Arial", 0, 14));
				numCompLabTxt.setForeground(new java.awt.Color(192, 192, 192));
				numCompLabTxt.setBounds(380, 266, 251, 26);
				numCompLabTxt.setEditable(true);
				numCompLabTxt.setEnabled(false);
				numCompLabTxt.addKeyListener(new KeyAdapter() {
					public void keyReleased(KeyEvent evt) {
						// numCompLabTxtKeyReleased(evt);
					}
				});
			}
			{
				nomeLabTxt = new JTextField();
				this.add(nomeLabTxt);
				nomeLabTxt.setFont(new java.awt.Font("Arial", 0, 14));
				nomeLabTxt.setForeground(new java.awt.Color(192, 192, 192));
				nomeLabTxt.setBounds(380, 225, 251, 26);
				nomeLabTxt.setEditable(true);
				nomeLabTxt.setEnabled(false);
				nomeLabTxt.addKeyListener(new KeyAdapter() {
					public void keyReleased(KeyEvent evt) {
						// nomeLabTxtKeyReleased(evt);
					}
				});
			}
			{
				horaFuncLab = new JLabel();
				this.add(horaFuncLab);
				horaFuncLab.setText("Horario de funcionamento incial");
				horaFuncLab.setFont(new java.awt.Font("Arial", 0, 18));
				horaFuncLab.setForeground(new java.awt.Color(0, 102, 102));
				horaFuncLab.setBounds(81, 353, 256, 29);
			}
			{
				capAlunosLab = new JLabel();
				this.add(capAlunosLab);
				capAlunosLab.setText("Capacidade de aluno no laboratorio");
				capAlunosLab.setFont(new java.awt.Font("Arial", 0, 18));
				capAlunosLab.setForeground(new java.awt.Color(0, 102, 102));
				capAlunosLab.setBounds(49, 311, 288, 29);
			}
			{
				numCompLab = new JLabel();
				this.add(numCompLab);
				numCompLab.setText("Numero de computadores do laboratorio");
				numCompLab.setFont(new java.awt.Font("Arial", 0, 18));
				numCompLab.setForeground(new java.awt.Color(0, 102, 102));
				numCompLab.setBounds(12, 268, 325, 29);
			}
			{
				nomeLab = new JLabel();
				this.add(nomeLab);
				nomeLab.setText("Nome do Laboratorio");
				nomeLab.setFont(new java.awt.Font("Arial", 0, 18));
				nomeLab.setForeground(new java.awt.Color(0, 102, 102));
				nomeLab.setBounds(164, 226, 173, 29);
			}
			{
				salvar = new JButton();
				this.add(salvar);
				salvar.setText("Salvar");
				salvar.setBackground(new java.awt.Color(255, 255, 255));
				salvar.setFont(new java.awt.Font("Arial", 0, 12));
				salvar.setBorder(BorderFactory
						.createEtchedBorder(BevelBorder.LOWERED));
				salvar.setBounds(553, 547, 101, 23);
				salvar.setEnabled(false);
			}
			{
				validaHoraFinit = new JLabel();
				this.add(validaHoraFinit);
				validaHoraFinit.setForeground(Color.red);
				validaHoraFinit.setBounds(543, 400, 60, 28);
			}
			{
				validaHoraInit = new JLabel();
				this.add(validaHoraInit);
				validaHoraInit.setForeground(Color.red);
				validaHoraInit.setBounds(543, 356, 60, 28);
			}
			{
				validaCapAluno = new JLabel();
				this.add(validaCapAluno);
				validaCapAluno.setText("");
				validaCapAluno.setForeground(Color.white);
				validaCapAluno.setBounds(654, 309, 60, 30);
			}
			{
				validaNumComp = new JLabel();
				this.add(validaNumComp);
				validaNumComp.setText("");
				validaNumComp.setForeground(Color.white);
				validaNumComp.setBounds(654, 266, 60, 30);
			}
			{
				validaNomeLab = new JLabel();
				this.add(validaNomeLab);
				validaNomeLab.setText("");
				validaNomeLab.setForeground(Color.white);
				validaNomeLab.setBounds(654, 225, 73, 29);
				criador();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void criador() {
		nomeLabTxt.setText(SelecionaLaboratorio.selecionado
				.getNomeDoLaboratorio());
		numCompLabTxt.setText(SelecionaLaboratorio.selecionado
				.getNumeroDeComputadores() + "");
		capAluLabTxt.setText(SelecionaLaboratorio.selecionado
				.getCapacidadeDeAlunos() + "");
		horaFuncInitA.setText(SelecionaLaboratorio.selecionado
				.getHorarioDeFuncionamentoInicial().substring(0, 2));

		horaFuncInitB.setText(SelecionaLaboratorio.selecionado
				.getHorarioDeFuncionamentoInicial().substring(3, 5));

		horaFuncFinalA.setText(SelecionaLaboratorio.selecionado
				.getHorarioDeFuncionamentoFinal().substring(0, 2));

		horaFuncFinalB.setText(SelecionaLaboratorio.selecionado
				.getHorarioDeFuncionamentoFinal().substring(3, 5));

	}

	private void jTextField1KeyReleased(KeyEvent evt) {
		System.out.println("jTextField1.keyReleased, event=" + evt);
		// TODO add your code for jTextField1.keyReleased
	}

}
